package com.usm.Laborator1;

import java.util.Scanner;

public class AdmitereLaInformatica {
    private static final Scanner scanner = new Scanner(System.in);
    private static double mediaBac = 0;
    private static double nMatematica = 0;
    private static double nInformatica = 0;
    private static double nMin = 5;
    private static double nAdmitere = 0;

    public static void main(String[] args) {

        promptVars();

        double result = 2 * nMin - maxForThreeVal(mediaBac, nMatematica, nInformatica);
        if (nAdmitere >= result) {
            System.out.println("Admis : nota admitere " + nAdmitere + " Rezultat : " + result);
        } else System.out.println("Ne admis : nota admitere " + nAdmitere + " Rezultat : " + result);
    }

    public static void promptVars() {
        System.out.println("Introduceti notele:");
        System.out.print("Media Bac : ");
        mediaBac = scanner.nextDouble();
        System.out.print("Nota Matematica : ");
        nMatematica = scanner.nextDouble();
        System.out.print("Nota Informatica : ");
        nInformatica = scanner.nextDouble();
        System.out.print("Nota Admitere : ");
        nAdmitere = scanner.nextDouble();
    }

    public static double maxForThreeVal(double mediaBac, double nMatematica, double nInformatica) {
        return Math.max(mediaBac, Math.max(nInformatica, nMatematica));
    }
}
